package com.codingman.jdbcdemo;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Types;

//Stored Procedure
public class Demo7 {

	public static void main(String[] args) {
		try {
			Class.forName("com.mysql.cj.jdbc.Driver");

			Connection con = DriverManager.getConnection("jdbc:mysql://45.77.187.28:3306/codingdb", "codingman",
					"Cm@123456");

			CallableStatement stmt = con.prepareCall("{call getEmpName(?)}");
			stmt.setInt(1, 101);
			stmt.registerOutParameter(1, Types.VARCHAR);
			stmt.execute();

			System.out.println(stmt.getInt(1));

			con.close();

		} catch (Exception e) {
			System.out.println(e);
		}

	}

}
